C.HelpMenuContents = {
	{
		"Credits",
		"Credits are a form of currency in Cosmos. You get credits by selling resources, and spend them on buying life support. You start with 20.\n\nTo sell resources, press F4 on a container and select what you want to sell.\n\nTo buy life support, just spawn an entity from the Life Support tab."
	},
	{
		"Life Support",
		"To survive in space, you need three types of resource: Oxygen and Coolant, and Energy to distribute them. To perform the life support process, you need three types of entities: Generators, Containers and Dispensers. They are spawned from the Cosmos tab in the spawn menu. You need Credits to spawn them.\n\n1. Generators\nThese entities need the requirements in the tooltip in the Cosmos tab. Once spawned, press E to turn them on or off. On entities will be green and red entities are off. A generator will turn off if its conditions are not met.\n\n2. Containers\nYou must link a generator to a container. Containers are the recipients of the generator's resources.\n\n3. Dispensers\nThese are the actual life support entities. Like generators, they are turned on and off, and have conditions. If they are on, they will fill the desired hazard.\n\nIf Oxygen and Coolant is being satisfied, congratulations! You're not dead!"
	},
	{
		"Link Tool",
		"As mentioned in Life Support, you need to link entities together in the right arrangement to have them function. Select the Link tool on the spawn menu, then click the two entities you want to link. Right click to remove all links from an entity."
	},
	{
		"Getting Started",
		"This is a tutorial on how to earn your first few credits.\n\n1. Open the spawn menu and go to the Cosmos tab. Spawn an Energy Cell and a Solar Panel.\n2. Take out the Link tool and link the two together.\n3. You will see the Energy Cell gaining energy. Wait for it to fill.\n4. When the Cell is full, press F4 and select Energy.\n5. Notice the credits at the bottom of the screen increase. You've just earned money!\n6. Continue adding more solar panels, or, a different container + generators. Try some other resources!"
	},
}

function umShowHelp()
	
	local p = vgui.Create( "DFrame" );
	p:SetSize( 600, 500 );
	p:Center();
	p:SetTitle( "Help" );
	p:MakePopup();

	local f = vgui.Create( "DPanel", p );
	f:SetPos( 10, 100 );
	f:SetSize( 580, 390 );

	local t = vgui.Create( "DLabel", f );
	t:SetPos( 5, 5 );
	t:SetSize( 570, 380 );
	t:SetText( "Welcome to Cosmos! Select a topic above." );
	t:SetWrap( true );

	local x = 0;

	for _, v in pairs( C.HelpMenuContents ) do
		
		local b = vgui.Create( "DButton", p );
		b:SetPos( 10 + x, 30 );
		b:SetSize( 100, 60 );
		b:SetText( v[1] );
		b.DoClick = function( self )
			
			t:SetText( v[2] );
			
		end
		
		x = x + 110;
		
	end
	
end
usermessage.Hook( "SH", umShowHelp );